package com.clinic.entity.db;

import java.io.Serializable;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@Table(name = UserContact.TABLE)
public class UserContact implements Serializable{

	private static final long serialVersionUID = -339741047544893979L;

	public static final String TABLE = "usercontact";
	
	public static final class Columns {
		public static final String CONTACT_ID = "contactId";
		public static final String TEL_NO = "telNo";
		public static final String ADDRESS = "address";
		public static final String USER_ID = "userId";
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = Columns.CONTACT_ID)
	private int contactId;
	
	@Column(name = Columns.TEL_NO)
	private String telNo;
	
	@Column(name = Columns.ADDRESS)
	private String address;
	
	@OneToOne(cascade=CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinColumn(name = Columns.USER_ID)
	private User user;

	public int getContactId() {
		return contactId;
	}

	public void setContactId(int contactId) {
		this.contactId = contactId;
	}

	public String getTelNo() {
		return telNo;
	}

	public void setTelNo(String telNo) {
		this.telNo = telNo;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
